<template>
  <div class="nav-bar">
    <van-nav-bar :title="title" :left-text="leftText" left-arrow @click-left="onClickLeft">
      <template #title>
        <slot name="title">{{ title }}</slot>
      </template>
    </van-nav-bar>
  </div>
</template>

<script setup>
  import { useRouter } from 'vue-router'
  defineProps({
    leftText: {
      type: String,
      default: ""
    },
    title: {
      type: String,
      default: ""
    }
  })

  const router = useRouter()
  const onClickLeft = () => {
    router.back()
  }
</script>

<style lang="less" scoped>

</style>